<?php
require_once 'conexao.php';

$login = @strtoupper(strtr($_POST['login'] ,"áéíóúâêôãõàèìòùç","ÁÉÍÓÚÂÊÔÃÕÀÈÌÒÙÇ"));;
$senha = md5($_POST['senha']);

$query = mysql_query("SELECT ID FROM usuario WHERE nome='$login' AND senha='$senha' AND bloqueado <> 1");
$campo = mysql_fetch_array($query);

if (mysql_num_rows ($query) > 0)
    {
    $_SESSION ['logado'] = true;
    $_SESSION['login'] = $login;
    
        echo "<script type='text/javascript'>
                document.location.href='\index.php?pagina=grade'
              </script> ";
    }else{

         echo "<script type='text/javascript'>
     alert('Senha ou usuario incorreto! tente novamente!'); document.location.href='\index.php?pagina=login'
     </script> ";
    }
    
?>
